#include "mxsetup.h"
#include "symbol.h"

LR_IROM1 MXSETUP_LOADREGION_ADDR MXSETUP_LOADREGION_SIZE  {         /* load region size_region */
    ER_IROM1 MXSETUP_LOADREGION_ADDR MXSETUP_LOADREGION_SIZE  {     /* load address = execution address */
        *.o (RESET, +First)
        .ANY (+RO)
        .ANY (+XO)
    }

    /* mxboardinit symbol array */
    symbol_section_build(mxboardinit, +0)

    /* mxappinit symbol array */
    symbol_section_build(mxappinit, +0)

    /* terminal symbol array */
    symbol_section_build(terminal, +0)

#ifdef MXSETUP_LOADREGION_IS_FLASH
    RW_IRAM1 MXSETUP_EXECREGION_ADDR MXSETUP_EXECREGION_SIZE  {     /* RW data, load address != execution address */
        .ANY (+RW +ZI)
    }
    /* The purpose of placing it separately is to facilitate copying .data into RAM
       Otherwise STACK will get mixed up with .data, and can't separate them by Image$$RW_IRAM1$$RW$$Base and Image$$RW_IRAM1$$RW$$Limit */
    RW_IRAM2 +0 {                                                   /* STACK, load address != execution address */
        .ANY (STACK, +First)
    }
#else
    RW_IRAM1 +0 {                                                   /* RW data, load address == execution address */
        .ANY (+RW +ZI)
    }
    RW_IRAM2 +0 {                                                   /* STACK, load address == execution address */
        .ANY (STACK, +First)
    }
#endif
}
